<template>
  <div class="join-parking-container">
    <div style="position: relative; width: 96%; height: 80rpx; display: flex">
      <div
        style="
          width: 50%;
          height: 100%;
          background: linear-gradient(to right, #ffdd01, #ff9900);
        "
      ></div>
      <div
        style="
          width: 50%;
          height: 100%;
          background: linear-gradient(to right, #ff9900, #ffdd01);
        "
      ></div>
      <h1 class="title">万亿互联网停车红利!</h1>
    </div>

    <view class="description-box">
      <view class="one-line-description">泊豆泊车平台累计：</view>
      <view class="one-line-descriptiontext">为100+车场引流1000万人次</view>
      <view class="one-line-descriptiontext">停车场月均停车率增加20%-50%</view>
    </view>
    <view style="position: relative; height: 1300rpx">
      <image
        src="../../static/chechangjiamengtitle.png"
        style="width: 100%; height: 300rpx"
      ></image>
      <view
        style="
          width: 100%;
          min-height: 100rpx;
          padding: 30rpx;
          background: #ffffff;
          box-sizing: border-box;
          position: absolute;
          top: 295rpx;
        "
      >
        <view
          style="
            width: 100%;
            min-height: 100rpx;
            background: #ffdd01;
            padding: 40rpx 30rpx;
            box-sizing: border-box;
            border-radius: 20rpx;
          "
        >
          <view style="font-weight: bold; margin-bottom: 30rpx"
            >商业案例1：某写字楼停车场</view
          >
          <view style="margin-top: 30rpx">原停车情况：</view>
          <view>工作日白天停车率65%</view>
          <view>工作日夜间、周末、节假日停车率10%</view>
          <view style="margin-top: 30rpx">原停车情况：</view>
          <view>工作日白天停车率65%</view>
          <view>工作日夜间、周末、节假日停车率10%</view>
        </view>
        <view
          style="
            width: 100%;
            min-height: 100rpx;
            background: #ffdd01;
            margin-top: 30rpx;
            padding: 40rpx 30rpx;
            box-sizing: border-box;
            border-radius: 20rpx;
          "
        >
          <view style="font-weight: bold">商业案例1：某写字楼停车场</view>
          <view style="margin-top: 30rpx">原停车情况：</view>
          <view>工作日白天停车率65%</view>
          <view>工作日夜间、周末、节假日停车率10%</view>
          <view style="margin-top: 30rpx">原停车情况：</view>
          <view>工作日白天停车率65%</view>
          <view>工作日夜间、周末、节假日停车率10%</view>
        </view>
      </view>
    </view>
    <h2
      class="form-title"
      style="font-size: 36rpx; font-weight: bold; margin-bottom: 10rpx"
    >
      申请加入泊豆泊车平台
    </h2>
    <view style="margin-bottom: 30rpx">
      提交信息后，平台客服将会与您联系沟通
    </view>
    <u--form
      :model="formData"
      ref="uForm"
      :rules="rules"
      labelPosition="left"
      labelWidth="230rpx"
    >
      <u-form-item label="车场名称" prop="parkingLotName"  >
        <u--input
          v-model="formData.parkingLotName"
          placeholder="请输入车场名称"
          border="none"
        />
      </u-form-item>

      <u-form-item label="所在城市" prop="city" >
        <u--input
          v-model="formData.city"
          placeholder="请输入城市"
          border="none"
        />
      </u-form-item>

      <u-form-item label="车场地址" prop="parkingIotAddress" >
        <u--input
          v-model="formData.parkingIotAddress"
          placeholder="请输入车场地址"
          border="none"
        />
      </u-form-item>

      <u-form-item label="联系人" prop="contactPerson" >
        <u--input
          v-model="formData.contactPerson"
          placeholder="请输入联系人姓名"
          border="none"
        />
      </u-form-item>

      <u-form-item label="联系电话" prop="contactPhone" >
        <u--input
          v-model="formData.contactPhone"
          placeholder="请输入联系电话"
          border="none"
        />
      </u-form-item>

      <u-form-item label="收费标准" prop="chargingStandard" >
        <u--input
          v-model="formData.chargingStandard"
          placeholder="请输入收费标准"
          border="none"
        />
      </u-form-item>

      <button type="submit" class="submit-btn" @click="handleSubmit">
        提交加盟信息
      </button>
    </u--form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formData: {
        parkingLotName: "",
        city: "",
        parkingIotAddress: "",
        contactPerson: "",
        contactPhone: "",
        chargingStandard: "",
      },
      rules: {
        parkingLotName: {
          type: "string",
          required: true,
          message: "请输入车场名称",
          trigger: ["blur", "change"],
        },
        city: {
          type: "string",
          required: true,
          message: "请输入城市",
          trigger: ["blur", "change"],
        },
        parkingIotAddress: {
          type: "string",
          required: true,
          message: "请输入车场地址",
          trigger: ["blur", "change"],
        },
        contactPerson: {
          type: "string",
          required: true,
          message: "请输入联系人",
          trigger: ["blur", "change"],
        },
        contactPhone: {
          type: "string",
          required: true,
          message: "请输入联系电话",
          trigger: ["blur", "change"],
        },
        chargingStandard: {
          type: "string",
          required: true,
          message: "请输入收费标准",
          trigger: ["blur", "change"],
        },
      },
    };
  },
  methods: {
    handleSubmit() {
      const self = this;
      this.$refs.uForm.validate().then((res) => {
        const formDataToSubmit = {
          ...this.formData,
        };
        self.$httpReq.saveFranchiseSave(formDataToSubmit).then((res) => {
          // 回到首页
          uni.switchTab({
            url: "/pages/index/index",
          });
          uni.showToast({
            title: "发布成功",
            icon: "success",
          });
        });
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.join-parking-container {
  padding: 20px;
  min-height: 100vh;
  margin: 0 auto;
  background: #ffdd01;

  ::v-deep .u-form-item__body {
    padding: 10rpx;
    border: 1px solid #ffffff;
    background: #ffffff;
    border-radius: 10rpx;
    margin-bottom: 20rpx;
    input {
      text-align: right;
    }
  }
}

.title {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
}

.description-box {
  border-radius: 8px;
  margin-bottom: 20px;
  margin-top: 20px;

  .one-line-description {
    text-align: center;
    font-size: 30rpx;
  }
  .one-line-descriptiontext {
    text-align: center;
    margin-top: 10rpx;
    font-size: 40rpx;
    font-weight: bold;
  }
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.join-form input {
  padding: 12rpx;
  border: 1px solid #797979;
  border-radius: 4px;
  font-size: 16px;
  margin-bottom: 20rpx;
}


.submit-btn {
  background-color: #e86333;
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 30rpx;
  cursor: pointer;
  margin-top: 30rpx;
}

.submit-btn:hover {
  background-color: #d55a2d;
}
</style>
